*****Conscription and Military Service: Do They Result in Future Violent and Non-Violent Incarcerations and Recidivism?  Wang, Flores-Lagunes 2020*****
***Table 2 Summary Stats
cd "C:\Users\xinto\Dropbox\Vietnam Veteran Paper\Crime Paper\2020 JHR Data\2. Table 2"

set more off
clear all
set memory 350m
set matsize 800

use inmate_sample_2020, clear 

***Restricted to 1948-1952 male cohort**********
keep if totalSample==1 
count 
sca n_all=r(N)
*************************************************
****             T  *****************************
****          0           1 *********************
****    0    nt&c       at&nt********************
****Z
*****   1    at         at&c ********************
*************************************************
**vv is the Vietnam veteran status

gen nvv=. 
replace nvv=1 if vv==0 
replace nvv=0 if vv==1
tab nvv 
gen T=vv
gen Z=eligible

***Summary statistics 
*Veteran status 
mean T [pweight=weight], over(white)
lincom [T]1-[T]0

mean Z [pweight=weight], over(white)
lincom [Z]1-[Z]0

mean currentViolent [pweight=weight] , over(white)
lincom [currentViolent]1-[currentViolent]0

mean incarcerationBefore1968 [pweight=weight] if incarcerationBefore1968!=9 , over(white)
lincom [incarcerationBefore1968]1-[incarcerationBefore1968]0

mean firstArrestBy18 [pweight=weight] if firstArrestBy18!=9 , over(white)
lincom [firstArrestBy18]1-[firstArrestBy18]0

mean probationBy18 [pweight=weight] if probationBy18!=9 , over(white)
lincom [probationBy18]1-[probationBy18]0

*never-taker
gen nt=1 if T==0 & Z==1
replace nt=0 if nt==.
*always-taker
gen at=1 if T==1 & Z==0
replace at=0 if at==.
*always-taker and complier 
gen atC=1 if T==1 & Z==1
replace atC=0 if atC==.
*never-taker and complier 
gen ntC=1 if T==0 & Z==0
replace ntC=0 if ntC==.

mean nt [pweight=weight] if nt!=9 & Z==1, over(white)
lincom [nt]1-[nt]0

mean at [pweight=weight] if at!=9 & Z==0, over(white)
lincom [at]1-[at]0

reg vv eligible [pweight=weight] if white==1

reg vv eligible [pweight=weight] if white==0

gen diff=eligible*white 

reg vv eligible white diff [pweight=weight] 


